Optimal. Leaf size=54 \[ -\frac {(a-b)^2 \cos (e+f x)}{f}+\frac {2 (a-b) b \sec (e+f x)}{f}+\frac {b^2 \sec ^3(e+f x)}{3 f} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.03, antiderivative size = 54, normalized size of antiderivative = 1.00, number of steps
used = 3, number of rules used = 2, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.095, Rules used = {3745, 276}
\begin {gather*} -\frac {(a-b)^2 \cos (e+f x)}{f}+\frac {2 b (a-b) \sec (e+f x)}{f}+\frac {b^2 \sec ^3(e+f x)}{3 f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 276
Rule 3745
Rubi steps
\begin {align*} \int \sin (e+f x) \left (a+b \tan ^2(e+f x)\right )^2 \, dx &=\frac {\text {Subst}\left (\int \frac {\left (a-b+b x^2\right )^2}{x^2} \, dx,x,\sec (e+f x)\right )}{f}\\ &=\frac {\text {Subst}\left (\int \left (2 (a-b) b+\frac {(a-b)^2}{x^2}+b^2 x^2\right ) \, dx,x,\sec (e+f x)\right )}{f}\\ &=-\frac {(a-b)^2 \cos (e+f x)}{f}+\frac {2 (a-b) b \sec (e+f x)}{f}+\frac {b^2 \sec ^3(e+f x)}{3 f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.21, size = 48, normalized size = 0.89 \begin {gather*} \frac {-3 (a-b)^2 \cos (e+f x)+b \sec (e+f x) \left (6 a-6 b+b \sec ^2(e+f x)\right )}{3 f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(124\) vs.
\(2(52)=104\).
time = 0.14, size = 125, normalized size = 2.31
method | result | size |
derivativedivides | \(\frac {b^{2} \left (\frac {\sin ^{6}\left (f x +e \right )}{3 \cos \left (f x +e \right )^{3}}-\frac {\sin ^{6}\left (f x +e \right )}{\cos \left (f x +e \right )}-\left (\frac {8}{3}+\sin ^{4}\left (f x +e \right )+\frac {4 \left (\sin ^{2}\left (f x +e \right )\right )}{3}\right ) \cos \left (f x +e \right )\right )+2 a b \left (\frac {\sin ^{4}\left (f x +e \right )}{\cos \left (f x +e \right )}+\left (2+\sin ^{2}\left (f x +e \right )\right ) \cos \left (f x +e \right )\right )-a^{2} \cos \left (f x +e \right )}{f}\) | \(125\) |
default | \(\frac {b^{2} \left (\frac {\sin ^{6}\left (f x +e \right )}{3 \cos \left (f x +e \right )^{3}}-\frac {\sin ^{6}\left (f x +e \right )}{\cos \left (f x +e \right )}-\left (\frac {8}{3}+\sin ^{4}\left (f x +e \right )+\frac {4 \left (\sin ^{2}\left (f x +e \right )\right )}{3}\right ) \cos \left (f x +e \right )\right )+2 a b \left (\frac {\sin ^{4}\left (f x +e \right )}{\cos \left (f x +e \right )}+\left (2+\sin ^{2}\left (f x +e \right )\right ) \cos \left (f x +e \right )\right )-a^{2} \cos \left (f x +e \right )}{f}\) | \(125\) |
risch | \(-\frac {{\mathrm e}^{i \left (f x +e \right )} a^{2}}{2 f}+\frac {{\mathrm e}^{i \left (f x +e \right )} a b}{f}-\frac {{\mathrm e}^{i \left (f x +e \right )} b^{2}}{2 f}-\frac {{\mathrm e}^{-i \left (f x +e \right )} a^{2}}{2 f}+\frac {{\mathrm e}^{-i \left (f x +e \right )} a b}{f}-\frac {{\mathrm e}^{-i \left (f x +e \right )} b^{2}}{2 f}-\frac {4 b \left (-3 a \,{\mathrm e}^{5 i \left (f x +e \right )}+3 b \,{\mathrm e}^{5 i \left (f x +e \right )}-6 a \,{\mathrm e}^{3 i \left (f x +e \right )}+4 b \,{\mathrm e}^{3 i \left (f x +e \right )}-3 a \,{\mathrm e}^{i \left (f x +e \right )}+3 b \,{\mathrm e}^{i \left (f x +e \right )}\right )}{3 f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{3}}\) | \(192\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.29, size = 77, normalized size = 1.43 \begin {gather*} \frac {6 \, a b {\left (\frac {1}{\cos \left (f x + e\right )} + \cos \left (f x + e\right )\right )} - b^{2} {\left (\frac {6 \, \cos \left (f x + e\right )^{2} - 1}{\cos \left (f x + e\right )^{3}} + 3 \, \cos \left (f x + e\right )\right )} - 3 \, a^{2} \cos \left (f x + e\right )}{3 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 2.11, size = 62, normalized size = 1.15 \begin {gather*} -\frac {3 \, {\left (a^{2} - 2 \, a b + b^{2}\right )} \cos \left (f x + e\right )^{4} - 6 \, {\left (a b - b^{2}\right )} \cos \left (f x + e\right )^{2} - b^{2}}{3 \, f \cos \left (f x + e\right )^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a + b \tan ^{2}{\left (e + f x \right )}\right )^{2} \sin {\left (e + f x \right )}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.80, size = 94, normalized size = 1.74 \begin {gather*} -\frac {a^{2} f^{3} \cos \left (f x + e\right ) - 2 \, a b f^{3} \cos \left (f x + e\right ) + b^{2} f^{3} \cos \left (f x + e\right )}{f^{4}} + \frac {6 \, a b \cos \left (f x + e\right )^{2} - 6 \, b^{2} \cos \left (f x + e\right )^{2} + b^{2}}{3 \, f \cos \left (f x + e\right )^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 14.12, size = 126, normalized size = 2.33 \begin {gather*} -\frac {8\,a\,b+{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^4\,\left (8\,a\,b-6\,a^2\right )+2\,a^2\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^6+{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2\,\left (6\,a^2-16\,a\,b+\frac {32\,b^2}{3}\right )-2\,a^2-\frac {16\,b^2}{3}}{f\,\left ({\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^8-2\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^6+2\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2-1\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________